package com.hlw.hr_man.controller;

import java.io.IOException;

import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;


import com.hlw.hr_man.service.EmployeeSrevice;
import com.hlw.hr_man.serviceImpl.EmployeeServiceImpl;
/**
 * 修改密码的controller
 * @author lh
 *
 */
public class ChangepwdController extends HttpServlet {
	EmployeeSrevice employeeservice=new EmployeeServiceImpl();
   @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	// TODO Auto-generated method stub
	doPost(req, resp);
}
   @Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf8");
		HttpSession session=req.getSession();
		PrintWriter pw=resp.getWriter();
		String  password=req.getParameter("pwd");
		int e_id=(int) session.getAttribute("employeeid");
		int i=employeeservice.updatePassword(password,e_id);
		pw.write(String.valueOf(i));
		
	}
}
